home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2001 September / PC-WELT 9-2001.ISO / software / hw / brennen / flask_src.exe / Input / inputStream.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-12  |  2.4 KB  |  116 lines

  1. /* 
  2.  *  inputStream.cpp 
  3.  *
  4.  *    Copyright (C) Alberto Vigata - January 2000 - ultraflask@yahoo.com
  5.  *
  6.  *  This file is part of FlasKMPEG, a free MPEG to MPEG/AVI converter
  7.  *    
  8.  *  FlasKMPEG is free software; you can redistribute it and/or modify
  9.  *  it under the terms of the GNU General Public License as published by
  10.  *  the Free Software Foundation; either version 2, or (at your option)
  11.  *  any later version.
  12.  *   
  13.  *  FlasKMPEG is distributed in the hope that it will be useful,
  14.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.  *  GNU General Public License for more details.
  17.  *   
  18.  *  You should have received a copy of the GNU General Public License
  19.  *  along with GNU Make; see the file COPYING.  If not, write to
  20.  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
  21.  *
  22.  */
  23.  
  24.  
  25. #ifndef INPUTSTREAM_H
  26. #define INPUTSTREAM_H
  27. #include "..\flaskmpeg.h"
  28. #include ".\IFOParser\IFOParser.h"
  29.  
  30. #define BtoMB(A) ((double)A/1048576)
  31.  
  32. //Open MODES
  33. #define DVD_MODE        1
  34. #define VERBOSE_MODE    2
  35.  
  36.  
  37. // Working MODES
  38. #define NORMAL_MODE          1
  39. #define PLAYSEQ_MODE    2
  40.  
  41. struct TPlaySequenceSpan
  42. {
  43.     i64 start;
  44.     i64 end;
  45. };
  46.  
  47. struct TPlaySequence
  48. {
  49.     int                  spanptr;
  50.     TPlaySequenceSpan    *sp;
  51.     int                  span_count;
  52.     i64                  total_size;
  53. };
  54.  
  55. struct TFile
  56. {
  57.     char        name[MAX_PATH+256];
  58.     __int64        position;
  59.     __int64        size;
  60.     __int64        firstSCR;
  61.     __int64     lastSCR;
  62.     FILE         *handle;
  63. };
  64.  
  65. struct TInputStream
  66. {
  67.     TFile        file[100];
  68.     int            nFiles;
  69.     int            actualFile;
  70.     __int64        totalSize;
  71.     __int64     globalPos;
  72.     bool        multipleFileMode;
  73. };
  74.  
  75. class CinputStream
  76. {
  77.     public:
  78.         int SetWorkingMode(int mode);
  79.         int ValidatePlaySequence();
  80.  
  81.         //File access functions
  82.         int OpenStream(char *, int mode);
  83.         int CloseStream();        
  84.  
  85.         int Read( ui8 *buffer, int size);
  86.  
  87.  
  88.         i64 GetStreamPos();
  89.         int    SetStreamPos( i64 pos );
  90.  
  91.         i64 GetStreamSize();
  92.  
  93.  
  94.         int SeekStream( i64 pos);
  95.         int SetOneFileMode(int n_file);
  96.         int SetMulFileMode();
  97.         
  98.         char *GetFileName();
  99.         
  100.         int AddSpan(TPlaySequenceSpan *span);
  101.  
  102.         CinputStream();
  103.         ~CinputStream();
  104.  
  105.     private:
  106.         int AlignStreamToSpan();
  107.         int workingMode;
  108.         int __read( ui8 *buffer, int size);
  109.         // _read locals
  110.         __int64 remainingBytes;
  111.         int ret;
  112.  
  113.         TPlaySequence   ps;
  114.     TInputStream    iStream;
  115. };
  116. #endif